package com.verlet.springbootdemo.simple.disruptor.netty.client;

import com.verlet.springbootdemo.simple.disruptor.netty.AbstractMessageConsumer;
import com.verlet.springbootdemo.simple.disruptor.netty.TranslatorData;
import com.verlet.springbootdemo.simple.disruptor.netty.TranslatorDataWapper;
import io.netty.util.ReferenceCountUtil;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MessageConsumerImpl extends AbstractMessageConsumer {
    public MessageConsumerImpl(String consumerId) {
        super(consumerId);
    }

    @Override
    public void onEvent(TranslatorDataWapper event) throws Exception {
        TranslatorData translatorData = event.getTranslatorData();
        try {
            log.info(translatorData.toString());
        }finally {
            ReferenceCountUtil.release(event);
        }

    }
}
